package cn.train.controler;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import cn.train.service.ContableService;
@WebServlet("/GetcidServlet")
public class GetcidServlet extends HttpServlet {
	
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		resp.setContentType("text/html;charset=UTF-8");
		PrintWriter out = resp.getWriter();

		String cidcard = req.getParameter("idcard");
	if(!cidcard.equals("")) {
	
		ContableService contableService = new ContableService();

	    Integer flag = contableService.Getcid(cidcard);
		if(flag==null) {
			flag=-1;
		}
//		System.out.println("jfksjf"+flag);
		if(flag>0) {								
			out.print(0);
			
	    }else{
	    	out.println(1);
	    } 
		
	}
		

	}
	
	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		doGet(req,resp);
	}

}
